package cn.wp.common.core;

import cn.wp.common.core.startup.StartupContainer;
import cn.wp.common.core.web.interceptor.WpInterceptorRegistryProxy;
import cn.wp.common.core.web.service.ServiceConfigurations;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 *
 * WpSetting 框架配置
 * Created by chenyb on 2019-09-24
 */
public abstract class WpSetting implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 拦截器注册代理类
        WpInterceptorRegistryProxy interceptorRegistryProxy = new WpInterceptorRegistryProxy(registry);
        configInterceptor(interceptorRegistryProxy);
    }

    /**
     * Service 配置
     * @param serviceConfigurations
     */
    public abstract void configService(ServiceConfigurations serviceConfigurations);

    /**
     * 拦截器配置
     * @param interceptorRegistryProxy
     */
    public abstract void configInterceptor(WpInterceptorRegistryProxy interceptorRegistryProxy);

    /**
     * 启动器配置
     * @param startupContainer
     */
    public abstract void configStartup(StartupContainer startupContainer);

    // 全局变量设置
   // public abstract void configProps(PropertyObject propertyObject);

    /**
     * 启动完成回调
     * @param wp
     */
    public abstract void onStart(Wp wp);

}